package chamber.helloworld;

import com.google.inject.Inject;
import com.google.inject.name.Named;
import common.Program;
import common.ProgramFactory;
import common.locale.LocaleModule;

import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Date;

/**
 * Created by Gerardo on 1/12/14.
 */
public class HelloWorld implements Program {
    private final String greeting;
    private final NumberFormat numberFormat;
    private final DateFormat timeFormat;

    @Inject
    public HelloWorld(final @Named("Greeting") String greeting, final @Named("Currency") NumberFormat numberFormat, final @Named("DateTime") DateFormat timeFormat) {
        this.greeting = greeting;
        this.numberFormat = numberFormat;
        this.timeFormat = timeFormat;
    }

    public static void main(final String[] args) {
        Program program = ProgramFactory.create(HelloWorld.class, new LocaleModule());
        program.execute();
    }

    @Override
    public void execute() {
        System.out.println(greeting);
        final long number = 10000000L;
        System.out.println(numberFormat.format(number));
        System.out.println(timeFormat.format(new Date()));
    }
}
